<template>
	<view class="page">
		<u-navbar title="设置" bgColor="transparent" titleStyle="color:#fff" placeholder autoBack leftIconColor="#fff">
			<!-- <view class="u-nav-slot ftwt" slot="left">
				<u-icon name="arrow-left" color="#000" size="20" bold></u-icon>
			</view>
			<view class="u-nav-slot" slot="center">
				<view class="ftwt fts18">经营分析</view>
			</view> -->
		</u-navbar>
		
		<view class="backFFF bor_radius8 pad20 mab30">
			<view class="fts14 c-000opacity25">检测站编号</view>
			<view class="input_box mab8"><input type="text" v-model="setInfo.tsno" placeholder="请输入检测站编号" /></view>
			<view class="displayAli_cen mab8">
				<view class="input_box mar-15 wid70">
					<view class="fts14 c-000opacity25">IP地址</view>
					<input class="" type="text" v-model="setInfo.IPNumber" placeholder="请输入IP" />
				</view>
				<view class="input_box">
					<view class="fts14 c-000opacity25">端口</view>
					<input v-model="setInfo.portNumber" placeholder="端口号" />
				</view>
			</view>
			<view class="input_box">
				<view class="fts14 c-000opacity25">接口序列号</view>
				<input v-model="setInfo.jkxlh" placeholder="请输入接口序列号"/>
			</view>
		</view>
		
		<view class="displayAli_cen justify-spb">
			<button class="Btn2 wid45" type="button" @click="clickClear">取消</button>
			<button class="Btn1 wid45" type="button" @click="clickSave">保存</button>
		</view>
		
		<!-- <view class="wid100 mat20 fts12 display justify-center" style="position: fixed;bottom:20px;left:50%;transform: translate(-50%,50%);">
			<view class="c-000opacity65">深圳市安车检测股份有限公司</view>
		</view> -->
		
	</view>
</template>
<script>
export default {
	data() {
		return {
			setInfo:{
				tsno:'52010000', // 检测站编号
				IPNumber:'172.0.0.12', // IP地址
				portNumber:'8081', // 端口号
				jkxlh:"52019440A4B6BEE53BDCD33C1119C07E", // 接口序列号
			}
			
		};
	},
	//第一次加载
	onLoad() {
		if(uni.getStorageSync('setInfo')){ // 缓存的设置信息
			this.setInfo=uni.getStorageSync('setInfo');
		}
	},
	//页面显示
	onShow() {},
	//方法
	methods: {
		clickClear(){
			uni.navigateBack()
		},
		clickSave(){
			let isEmpty = false;
			for(let key in this.setInfo){
				if(this.setInfo[key]==''){
					isEmpty=true;
				}
			}
			if(isEmpty){
				this.$all.toast('请填写完整')
				return
			}
			uni.setStorageSync('setInfo',this.setInfo);
			uni.setStorageSync('tsno',this.setInfo.tsno);
			uni.setStorageSync('IPNumber',this.setInfo.IPNumber);
			uni.setStorageSync('portNumber',this.setInfo.portNumber);
			uni.setStorageSync('jkxlh',this.setInfo.jkxlh);
			this.$all.toast('保存成功')
			console.log(this.setInfo);
			setTimeout(()=>{
				uni.navigateBack()
				// uni.reLaunch({
				// 	url: '/pages/login/login'
				// });
			},800)
		},
	},
	
};
</script>
<style lang="scss" scoped>
page{
	background-image: url('@/static/backImage/back1.png');
	background-color: #fff;
}
.page {
	padding: 20px;
	.input_box {
		border-bottom: 1rpx solid #f2f2f2;
		input {
			flex: 1;
			height: 80rpx;
			line-height: 80rpx;
			font-size: 30rpx;
		}
	}
}
</style>
